Reading and Printing a Directory Hierarchy :: 자바네트워크I/O[SSISO Community]
 
SSISO 카페 SSISO Source SSISO 구직 SSISO 쇼핑몰 SSISO 맛집
추천검색어 : JUnit   Log4j   ajax   spring   struts   struts-config.xml   Synchronized   책정보   Ajax 마스터하기   우측부분

자바네트워크I/O
[1]
등록일:2008-03-12 09:50:36 (0%)
작성자:
제목:Reading and Printing a Directory Hierarchy
import  java.io.File;
import  java.io.IOException;

public  class  FileUtil  {
    public  static  void  main(String[]  a)throws  IOException{
        showDir(1,  new  File("d:\\Java_Dev"));
    }
    static  void  showDir(int  indent,  File  file)  throws  IOException  {
        for  (int  i  =  0;  i  <  indent;  i++)
            System.out.print('-');
        System.out.println(file.getName());
        if  (file.isDirectory())  {
            File[]  files  =  file.listFiles();
            for  (int  i  =  0;  i  <  files.length;  i++)
                showDir(indent  +  4,  files[i]);
        }
    }
}

입력한  폴더의  하위  자료구조를  출력해  주는  예제
[본문링크] Reading and Printing a Directory Hierarchy
[1]
코멘트(이글의 트랙백 주소:/cafe/tb_receive.php?no=2517
작성자
비밀번호

 

SSISOCommunity

[이전]

Copyright byCopyright ⓒ2005, SSISO Community All Rights Reserved.